<include file="Public/head" />
<link type="text/css" rel="stylesheet" href="{:get_style_cdnurl()}paimai/yunying/plugin/select2/select2.css" />
<script src="{:get_style_cdnurl()}paimai/yunying/plugin/select2/select2.js" type="text/javascript"></script>
<style type='text/css'>
    #reserve_start_time{height:24px;border:solid 1px #c5c5c5;background:url(http://img1.isou365.cn/paimai/yunying/images/time_pic.jpg) no-repeat 120px 5px; cursor:pointer;}
    #reserve_end_time{height:24px;border:solid 1px #c5c5c5;background:url(http://img1.isou365.cn/paimai/yunying/images/time_pic.jpg) no-repeat 120px 5px;cursor:pointer;}
    .table tbody tr td a:link{color:#20ab4f;text-decoration: underline;}
    .table tbody tr td a:visited{text-decoration: underline;color:#303030;}
    .table tbody tr td a:hover{text-decoration: underline;color:#20ab4f;}
    .table tbody tr td a:active{color:#f99d0c;text-decoration: underline;}
    .table tbody tr td a.not-point{color:#9f9f9f; text-decoration: none;}
    .search6{display: block;clear: left;padding-top: 10px;}
    .search6-input{ margin-left: 0!important;}
</style>
</head>
<include file="Public/common_header" />
<div class="mian">
<include file="Public/sidebar"  menu="clcwht.zxfb" />
    <div class="mianR">
        <div class="yuList" >
        	<form id="searchFrom">
            <div class="yuSuo clearfix">
                <div id="new_owner" class="xinzeng clearfix">
                    <input type="button" onclick="window.location.href='/Article/add';" value="新增文章" />
                    <!--input type="button" onclick="window.location.href='/Article/categoryList';" value="分类管理" /-->
                </div>
                <div id="search1">
                    <select id="category_id" name="category_id" class="branch_company">
                    	<option value="0">请选择主频道</option>
                    	<volist name="cate" id="vo" key="k">
                    		<option value="{$vo.category_id}">{$vo.category_title}</option>
                    	</volist>
                    </select>
                    <select id="child_id" name="child_id" class="branch_company">
                            <option value="0">请选择子频道</option>
                    </select>
                    <select id="status" name="status" class="branch_company">
                    	<option value="">请选择发布状态</option>
                    	<!--<option value="0">删除</option>-->
                    	<option value="1">已发布</option>
                        <option value="2">未发布</option>
                        <option value="3">预发布</option>
                    </select>
                    <input type="text" id="article_title" name="article_title" placeholder="请输入标题关键字" value="">
                </div>
                <input type="button" onclick="searchList();" id="search" value="搜索" class="suoSou">
                <input type="button" onclick="window.location=window.location.href" value="全部" class="suoSou">
            </div>
            <div class="yuSuo clearfix">
                <div id="search1">
                    <select id="type" name="type" class="branch_company">
                        <option value="0">请选择资讯性质</option>
                        <option value="1">原创</option>
                        <option value="2">转载</option>
                    </select>
                    <select id="attribute" name="attribute" class="branch_company">
                        <option value="0">请选择资讯类型</option>
                        <option value="1">图文</option>
                        <option value="2">视频</option>
                    </select>
                    <select id="from_name" name="from_name" class="branch_company">
                        <option value="0">请选择资讯来源</option>
                        <option value="车享家">车享家</option>
                        <option value="易车">易车</option>
                        <option value="搜狐汽车">搜狐汽车</option>
                        <option value="汽车之家">汽车之家</option>
                    </select>
                    <span>是否精华：</span><span>是</span><input type="radio" name="is_top" value="1" /><span>&nbsp;&nbsp;&nbsp;&nbsp;</span><span>否</span><input type="radio" name="is_top" value="0" />
                    <input type="text" id="start_time" name="start_time" value="" readonly placeholder="发布时间起"/><em></em>
                    <input type="text" id="end_time" name="end_time" value="" readonly placeholder="发布时间止" style="margin-right: 10px;"/>
                    <select id="sort" name="sort" class="branch_company">
                        <option value="">默认排序</option>
                        <option value="pv-desc">PV从高到低</option>
                        <option value="uv-desc">UV从高到低</option>
                        <option value="comment-desc">评论数从高到低</option>
                        <option value="pv-asc">PV从低到高</option>
                        <option value="uv-asc">UV从低到高</option>
                        <option value="comment-asc">评论数从低到高</option>
                    </select>
                </div>
            </div>
            </form>
        </div>
      <div class="listBox" id="listBox">

      </div>
   </div>
    <div class="clear"></div>
    <include file="Public/foot" />
<script type="text/javascript">
    $(function(){
        $("#category_id").change(function(){
        	var category_id = $(this).val();
        	if(category_id > 0){
        		$.get('/Article/getChildCategory', {category_id:category_id}, function(data){
            		var html = '<option value="">全部</option>';
            		
            		for(var i in data){
            			html += "<option value=\""+data[i].category_id+"\">"+data[i].category_title+"</option>";
            		}
            		
            		$('#child_id').html(html);
            		
            	},'json');
        	}else{
        		$('#child_id').html('');
        	}
        });
    });
    $("#start_time").ymdateplugin({
        changeMonth: true,
        changeYear: true
    });
    $("#end_time").ymdateplugin({
        changeMonth: true,
        changeYear: true
    });
    var page = 1;

    get_list();

    function get_list(params){
        var url = get_url();
        
        $.get("/article/articleList",params, function(data){
            $("#listBox").html(data);
        },"html");
    }

    function searchList(){
    	var params = {};
    	var is_top = $('input[name="is_top"]:checked').val();
    	params.p = page;
		if(is_top){
			params.is_top = is_top;
		}
    	var article_title = $('#article_title').val();
    	if(article_title){
    		params.article_title = article_title;
    	}
    	var category_id = $('#category_id').val();
    	if(category_id){
    		params.category_id = category_id;
    	}
        var child_id = $('#child_id').val();
        if(child_id){
            params.child_id = child_id;
        }
        var attribute = $('#attribute').val();
        if(attribute){
            params.attribute = attribute;
        }
    	var status = $('#status').val();
    	if(status){
    		params.status = status;
    	}
        var type = $('#type').val();
        if(type){
            params.type = type;
        }
        var from_name = $('#from_name').val();
        if(from_name){
            params.from_name = from_name;
        }
        var sort = $('#sort').val();
        if (sort){
            params.sort = sort;
        }
        var start_time = $('#start_time').val();
        if (start_time) {
            params.start_time = start_time;
        }
        var end_time = $('#end_time').val();
        if (end_time) {
            params.end_time = end_time;
        }
    	
    	get_list(params);
    	
    }
    function get_page(p) {
        page = p;
        searchList();
    }
    

    function get_url(){
        var url = "";
        return url;
    }


</script>